/**
 * Zhz.net Inc.
 * Copyright (c) 2004-2010 All Rights Reserved.
 */
package com.zhz.lib.project.ibatis.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.zhz.lib.project.ibatis.daointerface.FaqDAO;
import com.zhz.lib.project.ibatis.dataobject.Faq;

/**
 *
 * @author Administrator
 * @version $Id: FaqDAOImpl.java, v 0.1 Sep 16, 2010 7:58:53 AM Administrator Exp $
 */
public class FaqDAOImpl extends SqlMapClientDaoSupport implements FaqDAO {

    public Faq getFaqById(String id) {
        return (Faq) getSqlMapClientTemplate().queryForObject("getFaqById", id);
    }

    public List<Faq> getAllFaq(int firstResult, int maxResults) {

        Map map = new HashMap<String, Integer>();
        map.put("firstResult", firstResult);
        map.put("maxResults", maxResults);
        List list = null;
        try {
            list = getSqlMapClientTemplate().queryForList("getAllFaq", map);
        } catch (DataAccessException e) {
            logger.error("getAllFaq发生异常", e);
        }
        return list;
    }

}
